package per.ethan.cloud.provider.api;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import per.ethan.cloud.common.domain.ResultBean;
import per.ethan.cloud.provider.api.entity.Payment;
import per.ethan.cloud.provider.api.factory.RemotePaymentServiceFallbackFactory;

/**
 * @author Ethan
 * @date 2020/03/28 14:00
 */
@FeignClient(value = "cloud-provider", path = "/payment", fallbackFactory = RemotePaymentServiceFallbackFactory.class)
public interface RemotePaymentService {

    @PostMapping
    ResultBean<Long> save(@RequestBody Payment payment);

    @GetMapping(value = "/{id}")
    ResultBean<Payment> getById(@PathVariable("id") Long id);

    @GetMapping(value = "/feignTimeout")
    ResultBean<String> feignTimeout();

    @GetMapping(value = "/hello")
    ResultBean<String> hello();

}
